package com.study.connect.client.handler;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

/**
 * @包名称 com.study.connect.client.handler
 * @类描述 <pre></pre>
 * @作者 zhangbo
 * @创建时间 2020/6/13.
 * @版本 1.00
 * @修改记录 <pre>
 *     版本           修改人         修改日期         修改内容描述
 *     -----------------------------------------------------------
 *     1.00           zhangbo        2020/6/13.           类创建
 *     -----------------------------------------------------------
 * </pre>
 */
@Slf4j
@Setter
public class ClientHandler extends ChannelInboundHandlerAdapter {

    private HandlerCallable handlerCallable;

    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
        log.info("收到返回消息：{}", msg);
        this.handlerCallable.setResult(msg);
        handlerCallable.getCountDownLatch().countDown();
    }

}
